//
//  SinaTabBarViewController.swift
//  SinaWeibo
//
//  Created by dong on 15/12/30.
//  Copyright © 2015年 dong. All rights reserved.
//

import UIKit

class SinaTabBarViewController: UITabBarController {

    override func viewDidLoad() {
        super.viewDidLoad()

        addChildViewController()
    
        
        
        
        
        
    }
    
    func addChildViewController() {
        addChildViewController(SinaHomeTVController(), title: "首页", image: "tabbar_home")
        addChildViewController(SinaMessageTVController(), title: "消息", image: "tabbar_message_center")
        addChildViewController(SinaDiscoverTVController(), title: "发现", image: "tabbar_discover")
        addChildViewController(SinaSettingTVController(), title: "设置", image: "tabbar_profile")
    }

    func addChildViewController(childController: UIViewController,title:String,image:String) {
        
        childController.title = title
        
        childController.tabBarItem.image = UIImage(named: image)
        
        childController.tabBarItem.selectedImage = UIImage(named: "\(image)_highlighted")
        
        let nav = UINavigationController(rootViewController: childController)
        
        addChildViewController(nav)
   
        
    }
   
}
